home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / gdb / gdb.info-2 < prev    next >
Encoding:
Text File  |  1992-04-11  |  49.3 KB  |  1,217 lines

  1. Info file ./gdb.info, produced by Makeinfo, -*- Text -*- from input
  2. file gdb-all.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Gdb: (gdb).                   The GNU debugger.
  6. END-INFO-DIR-ENTRY
  7.    This file documents the GNU debugger GDB.
  8.  
  9.    This is Edition 4.04, March 1992, of `Using GDB: A Guide to the GNU
  10. Source-Level Debugger' for GDB Version 4.5.
  11.  
  12.    Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software
  13. Foundation, Inc.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of
  16. this manual provided the copyright notice and this permission notice
  17. are preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided also
  21. that the section entitled "GNU General Public License" is included
  22. exactly as in the original, and provided that the entire resulting
  23. derived work is distributed under the terms of a permission notice
  24. identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that the section entitled "GNU General Public
  29. License" may be included in a translation approved by the Free
  30. Software Foundation instead of in the original English.
  31.  
  32. 
  33. File: gdb.info,  Node: Input/Output,  Next: Attach,  Prev: Working Directory,  Up: Running
  34.  
  35. Your Program's Input and Output
  36. ===============================
  37.  
  38.    By default, the program you run under GDB does input and output to
  39. the same terminal that GDB uses.  GDB switches the terminal to its own
  40. terminal modes to interact with you, but it records the terminal modes
  41. your program was using and switches back to them when you continue
  42. running your program.
  43.  
  44. `info terminal'
  45.      Displays GDB's recorded information about the terminal modes your
  46.      program is using.
  47.  
  48.    You can redirect your program's input and/or output using shell
  49. redirection with the `run' command.  For example,
  50.  
  51.      run > outfile
  52.  
  53. starts your program, diverting its output to the file `outfile'.
  54.  
  55.    Another way to specify where your program should do input and
  56. output is with the `tty' command.  This command accepts a file name as
  57. argument, and causes this file to be the default for future `run'
  58. commands.  It also resets the controlling terminal for the child
  59. process, for future `run' commands.  For example,
  60.  
  61.      tty /dev/ttyb
  62.  
  63. directs that processes started with subsequent `run' commands default
  64. to do input and output on the terminal `/dev/ttyb' and have that as
  65. their controlling terminal.
  66.  
  67.    An explicit redirection in `run' overrides the `tty' command's
  68. effect on the input/output device, but not its effect on the
  69. controlling terminal.
  70.  
  71.    When you use the `tty' command or redirect input in the `run'
  72. command, only the input *for your program* is affected.  The input for
  73. GDB still comes from your terminal.
  74.  
  75. 
  76. File: gdb.info,  Node: Attach,  Next: Kill Process,  Prev: Input/Output,  Up: Running
  77.  
  78. Debugging an Already-Running Process
  79. ====================================
  80.  
  81. `attach PROCESS-ID'
  82.      This command attaches to a running process--one that was started
  83.      outside GDB.  (`info files' will show your active targets.)  The
  84.      command takes as argument a process ID.  The usual way to find
  85.      out the process-id of a Unix process is with the `ps' utility, or
  86.      with the `jobs -l' shell command.
  87.  
  88.      `attach' will not repeat if you press RET a second time after
  89.      executing the command.
  90.  
  91.    To use `attach', you must be debugging in an environment which
  92. supports processes.  You must also have permission to send the process
  93. a signal, and it must have the same effective user ID as the GDB
  94. process.
  95.  
  96.    When using `attach', you should first use the `file' command to
  97. specify the program running in the process and load its symbol table. 
  98. *Note Commands to Specify Files: Files.
  99.  
  100.    The first thing GDB does after arranging to debug the specified
  101. process is to stop it.  You can examine and modify an attached process
  102. with all the GDB commands that are ordinarily available when you start
  103. processes with `run'.  You can insert breakpoints; you can step and
  104. continue; you can modify storage.  If you would rather the process
  105. continue running, you may use the `continue' command after attaching
  106. GDB to the process.
  107.  
  108. `detach'
  109.      When you have finished debugging the attached process, you can
  110.      use the `detach' command to release it from GDB's control. 
  111.      Detaching the process continues its execution.  After the
  112.      `detach' command, that process and GDB become completely
  113.      independent once more, and you are ready to `attach' another
  114.      process or start one with `run'.  `detach' will not repeat if you
  115.      press RET again after executing the command.
  116.  
  117.    If you exit GDB or use the `run' command while you have an attached
  118. process, you kill that process.  By default, you will be asked for
  119. confirmation if you try to do either of these things; you can control
  120. whether or not you need to confirm by using the `set confirm' command
  121. (*note Optional Warnings and Messages: Messages/Warnings.).
  122.  
  123. 
  124. File: gdb.info,  Node: Kill Process,  Next: Process Information,  Prev: Attach,  Up: Running
  125.  
  126. Killing the Child Process
  127. =========================
  128.  
  129. `kill'
  130.      Kill the child process in which your program is running under GDB.
  131.  
  132.    This command is useful if you wish to debug a core dump instead of a
  133. running process.  GDB ignores any core dump file while your program is
  134. running.
  135.  
  136.    On some operating systems, a program cannot be executed outside GDB
  137. while you have breakpoints set on it inside GDB.  You can use the
  138. `kill' command in this situation to permit running your program
  139. outside the debugger.
  140.  
  141.    The `kill' command is also useful if you wish to recompile and
  142. relink your program, since on many systems it is impossible to modify
  143. an executable file while it is running in a process.  In this case,
  144. when you next type `run', GDB will notice that the file has changed,
  145. and will re-read the symbol table (while trying to preserve your
  146. current breakpoint settings).
  147.  
  148. 
  149. File: gdb.info,  Node: Process Information,  Prev: Kill Process,  Up: Running
  150.  
  151. Additional Process Information
  152. ==============================
  153.  
  154.    Some operating systems provide a facility called `/proc' that can
  155. be used to examine the image of a running process using file-system
  156. subroutines.  If GDB is configured for an operating system with this
  157. facility, the command `info proc' is available to report on several
  158. kinds of information about the process running your program.
  159.  
  160. `info proc'
  161.      Summarize available information about the process.
  162.  
  163. `info proc mappings'
  164.      Report on the address ranges accessible in the program, with
  165.      information on whether your program may read, write, or execute
  166.      each range.
  167.  
  168. `info proc times'
  169.      Starting time, user CPU time, and system CPU time for your
  170.      program and its children.
  171.  
  172. `info proc id'
  173.      Report on the process ID's related to your program: its own
  174.      process id, the id of its parent, the process group id, and the
  175.      session id.
  176.  
  177. `info proc status'
  178.      General information on the state of the process.  If the process
  179.      is stopped, this report includes the reason for stopping, and any
  180.      signal received.
  181.  
  182. `info proc all'
  183.      Show all the above information about the process.
  184.  
  185. 
  186. File: gdb.info,  Node: Stopping,  Next: Stack,  Prev: Running,  Up: Top
  187.  
  188. Stopping and Continuing
  189. ***********************
  190.  
  191.    The principal purpose of using a debugger is so that you can stop
  192. your program before it terminates; or so that, if your program runs
  193. into trouble, you can investigate and find out why.
  194.  
  195.    Inside GDB, your program may stop for any of several reasons, such
  196. as a signal, a breakpoint, or reaching a new line after a GDB command
  197. such as `step'.  You may then examine and change variables, set new
  198. breakpoints or remove old ones, and then continue execution.  Usually,
  199. the messages shown by GDB provide ample explanation of the status of
  200. your program--but you can also explicitly request this information at
  201. any time.
  202.  
  203. `info program'
  204.      Display information about the status of your program: whether it
  205.      is running or not, what process it is, and why it stopped.
  206.  
  207. * Menu:
  208.  
  209. * Breakpoints::                 Breakpoints, Watchpoints, and Exceptions
  210. * Continuing and Stepping::     Resuming Execution
  211. * Signals::                     Signals
  212.  
  213. 
  214. File: gdb.info,  Node: Breakpoints,  Next: Continuing and Stepping,  Prev: Stopping,  Up: Stopping
  215.  
  216. Breakpoints, Watchpoints, and Exceptions
  217. ========================================
  218.  
  219.    A "breakpoint" makes your program stop whenever a certain point in
  220. the program is reached.  For each breakpoint, you can add various
  221. conditions to control in finer detail whether your program will stop. 
  222. You can set breakpoints with the `break' command and its variants
  223. (*note Setting Breakpoints: Set Breaks.), to specify the place where
  224. your program should stop by line number, function name or exact address
  225. in the program.  In languages with exception handling (such as GNU
  226. C++), you can also set breakpoints where an exception is raised (*note
  227. Breakpoints and Exceptions: Exception Handling.).
  228.  
  229.    A "watchpoint" is a special breakpoint that stops your program when
  230. the value of an expression changes.  You must use a different command
  231. to set watchpoints (*note Setting Watchpoints: Set Watchpoints.), but
  232. aside from that, you can manage a watchpoint like any other
  233. breakpoint: you enable, disable, and delete both breakpoints and
  234. watchpoints using the same commands.
  235.  
  236.    GDB assigns a number to each breakpoint or watchpoint when you
  237. create it; these numbers are successive integers starting with one.  In
  238. many of the commands for controlling various features of breakpoints
  239. you use the breakpoint number to say which breakpoint you want to
  240. change.  Each breakpoint may be "enabled" or "disabled"; if disabled,
  241. it has no effect on your program until you enable it again.
  242.  
  243. * Menu:
  244.  
  245. * Set Breaks::                  Setting Breakpoints
  246. * Set Watchpoints::             Setting Watchpoints
  247. * Exception Handling::          Breakpoints and Exceptions
  248. * Delete Breaks::               Deleting Breakpoints
  249. * Disabling::                   Disabling Breakpoints
  250. * Conditions::                  Break Conditions
  251. * Break Commands::              Breakpoint Command Lists
  252. * Breakpoint Menus::            Breakpoint Menus
  253. * Error in Breakpoints::
  254.  
  255. 
  256. File: gdb.info,  Node: Set Breaks,  Next: Set Watchpoints,  Prev: Breakpoints,  Up: Breakpoints
  257.  
  258. Setting Breakpoints
  259. -------------------
  260.  
  261.    Breakpoints are set with the `break' command (abbreviated `b'). 
  262. The debugger convenience variable `$bpnum' records the number of the
  263. beakpoint you've set most recently; see *Note Convenience Variables:
  264. Convenience Vars, for a discussion of what you can do with convenience
  265. variables.
  266.  
  267.    You have several ways to say where the breakpoint should go.
  268.  
  269. `break FUNCTION'
  270.      Set a breakpoint at entry to function FUNCTION.  When using source
  271.      languages that permit overloading of symbols, such as C++,
  272.      FUNCTION may refer to more than one possible place to break. 
  273.      *Note Breakpoint Menus::, for a discussion of that situation.
  274.  
  275. `break +OFFSET'
  276. `break -OFFSET'
  277.      Set a breakpoint some number of lines forward or back from the
  278.      position at which execution stopped in the currently selected
  279.      frame.
  280.  
  281. `break LINENUM'
  282.      Set a breakpoint at line LINENUM in the current source file. 
  283.      That file is the last file whose source text was printed.  This
  284.      breakpoint will stop your program just before it executes any of
  285.      the code on that line.
  286.  
  287. `break FILENAME:LINENUM'
  288.      Set a breakpoint at line LINENUM in source file FILENAME.
  289.  
  290. `break FILENAME:FUNCTION'
  291.      Set a breakpoint at entry to function FUNCTION found in file
  292.      FILENAME.  Specifying a file name as well as a function name is
  293.      superfluous except when multiple files contain similarly named
  294.      functions.
  295.  
  296. `break *ADDRESS'
  297.      Set a breakpoint at address ADDRESS.  You can use this to set
  298.      breakpoints in parts of your program which do not have debugging
  299.      information or source files.
  300.  
  301. `break'
  302.      When called without any arguments, `break' sets a breakpoint at
  303.      the next instruction to be executed in the selected stack frame
  304.      (*note Examining the Stack: Stack.).  In any selected frame but
  305.      the innermost, this will cause your program to stop as soon as
  306.      control returns to that frame.  This is similar to the effect of a
  307.      `finish' command in the frame inside the selected frame--except
  308.      that `finish' does not leave an active breakpoint.  If you use
  309.      `break' without an argument in the innermost frame, GDB will stop
  310.      the next time it reaches the current location; this may be useful
  311.      inside loops.
  312.  
  313.      GDB normally ignores breakpoints when it resumes execution, until
  314.      at least one instruction has been executed.  If it did not do
  315.      this, you would be unable to proceed past a breakpoint without
  316.      first disabling the breakpoint.  This rule applies whether or not
  317.      the breakpoint already existed when your program stopped.
  318.  
  319. `break ... if COND'
  320.      Set a breakpoint with condition COND; evaluate the expression
  321.      COND each time the breakpoint is reached, and stop only if the
  322.      value is nonzero--that is, if COND evaluates as true.  `...'
  323.      stands for one of the possible arguments described above (or no
  324.      argument) specifying where to break.  *Note Break Conditions:
  325.      Conditions, for more information on breakpoint conditions.
  326.  
  327. `tbreak ARGS'
  328.      Set a breakpoint enabled only for one stop.  ARGS are the same as
  329.      for the `break' command, and the breakpoint is set in the same
  330.      way, but the breakpoint is automatically disabled after the first
  331.      time your program stops there.  *Note Disabling Breakpoints:
  332.      Disabling.
  333.  
  334. `rbreak REGEX'
  335.      Set breakpoints on all functions matching the regular expression
  336.      REGEX.  This command sets an unconditional breakpoint on all
  337.      matches, printing a list of all breakpoints it set. Once these
  338.      breakpoints are set, they are treated just like the breakpoints
  339.      set with the `break' command.  They can be deleted, disabled,
  340.      made conditional, etc., in the standard ways.
  341.  
  342.      When debugging C++ programs, `rbreak' is useful for setting
  343.      breakpoints on overloaded functions that are not members of any
  344.      special classes.
  345.  
  346. `info breakpoints [N]'
  347. `info break [N]'
  348. `info watchpoints [N]'
  349.      Print a table of all breakpoints and watchpoints set and not
  350.      deleted, with the following columns for each breakpoint:
  351.  
  352.     *Breakpoint Numbers*
  353.     *Type*
  354.           Breakpoint or watchpoint.
  355.  
  356.     *Disposition*
  357.           Whether the breakpoint is marked to be disabled or deleted
  358.           when hit.
  359.  
  360.     *Enabled or Disabled*
  361.           Enabled breakpoints are marked with `y'.  `n' marks
  362.           breakpoints that are not enabled.
  363.  
  364.     *Address*
  365.           Where the breakpoint is in your program, as a memory address
  366.  
  367.     *What*
  368.           Where the breakpoint is in the source for your program, as a
  369.           file and line number.
  370.  
  371.      Breakpoint commands, if any, are listed after the line for the
  372.      corresponding breakpoint.
  373.  
  374.      `info break' with a breakpoint number N as argument lists only
  375.      that breakpoint.  The convenience variable `$_' and the default
  376.      examining-address for the `x' command are set to the address of
  377.      the last breakpoint listed (*note Examining Memory: Memory.).
  378.  
  379.    GDB allows you to set any number of breakpoints at the same place in
  380. your program.  There is nothing silly or meaningless about this.  When
  381. the breakpoints are conditional, this is even useful (*note Break
  382. Conditions: Conditions.).
  383.  
  384.    GDB itself sometimes sets breakpoints in your program for special
  385. purposes, such as proper handling of `longjmp' (in C programs).  These
  386. internal breakpoints are assigned negative numbers, starting with
  387. `-1'; `info breakpoints' does not display them, but the similar
  388. command `info all-breakpoints' does.
  389.  
  390. `info all-breakpoints'
  391.      Using the same format as `info breakpoints', display both the
  392.      breakpoints you've set explicitly, and those GDB is using for
  393.      internal purposes.  Internal breakpoints are shown with negative
  394.      breakpoint numbers.  The type column identifies what kind of
  395.      breakpoint is shown:
  396.  
  397.     `breakpoint'
  398.           Normal, explicitly set breakpoint.
  399.  
  400.     `watchpoint'
  401.           Normal, explicitly set watchpoint.
  402.  
  403.     `longjmp'
  404.           Internal breakpoint, used to handle correctly stepping
  405.           through `longjmp' calls.
  406.  
  407.     `longjmp resume'
  408.           Internal breakpoint at the target of a `longjmp'.
  409.  
  410.     `until'
  411.           Temporary internal breakpoint used by the GDB `until'
  412.           command.
  413.  
  414.     `finish'
  415.           Temporary internal breakpoint used by the GDB `finish'
  416.           command.
  417.  
  418. 
  419. File: gdb.info,  Node: Set Watchpoints,  Next: Exception Handling,  Prev: Set Breaks,  Up: Breakpoints
  420.  
  421. Setting Watchpoints
  422. -------------------
  423.  
  424.    You can use a watchpoint to stop execution whenever the value of an
  425. expression changes, without having to predict a particular place where
  426. this may happen.
  427.  
  428.    Watchpoints currently execute two orders of magnitude more slowly
  429. than other breakpoints, but this can well be worth it to catch errors
  430. where you have no clue what part of your program is the culprit.  Some
  431. processors provide special hardware to support watchpoint evaluation;
  432. future releases of GDB will use such hardware if it is available.
  433.  
  434. `watch EXPR'
  435.      Set a watchpoint for an expression.
  436.  
  437. `info watchpoints'
  438.      This command prints a list of watchpoints and breakpoints; it is
  439.      the same as `info break'.
  440.  
  441. 
  442. File: gdb.info,  Node: Exception Handling,  Next: Delete Breaks,  Prev: Set Watchpoints,  Up: Breakpoints
  443.  
  444. Breakpoints and Exceptions
  445. --------------------------
  446.  
  447.    Some languages, such as GNU C++, implement exception handling.  You
  448. can use GDB to examine what caused your program to raise an exception,
  449. and to list the exceptions your program is prepared to handle at a
  450. given point in time.
  451.  
  452. `catch EXCEPTIONS'
  453.      You can set breakpoints at active exception handlers by using the
  454.      `catch' command.  EXCEPTIONS is a list of names of exceptions to
  455.      catch.
  456.  
  457.    You can use `info catch' to list active exception handlers.  *Note
  458. Information About a Frame: Frame Info.
  459.  
  460.    There are currently some limitations to exception handling in GDB. 
  461. These will be corrected in a future release.
  462.  
  463.    * If you call a function interactively, GDB normally returns
  464.      control to you when the function has finished executing.  If the
  465.      call raises an exception, however, the call may bypass the
  466.      mechanism that returns control to you and cause your program to
  467.      simply continue running until it hits a breakpoint, catches a
  468.      signal that GDB is listening for, or exits.
  469.  
  470.    * You cannot raise an exception interactively.
  471.  
  472.    * You cannot interactively install an exception handler.
  473.  
  474.    Sometimes `catch' is not the best way to debug exception handling:
  475. if you need to know exactly where an exception is raised, it is better
  476. to stop *before* the exception handler is called, since that way you
  477. can see the stack before any unwinding takes place.  If you set a
  478. breakpoint in an exception handler instead, it may not be easy to find
  479. out where the exception was raised.
  480.  
  481.    To stop just before an exception handler is called, you need some
  482. knowledge of the implementation.  In the case of GNU C++, exceptions
  483. are raised by calling a library function named `__raise_exception'
  484. which has the following ANSI C interface:
  485.  
  486.          /* ADDR is where the exception identifier is stored.
  487.             ID is the exception identifier.  */
  488.          void __raise_exception (void **ADDR, void *ID);
  489.  
  490. To make the debugger catch all exceptions before any stack unwinding
  491. takes place, set a breakpoint on `__raise_exception' (*note
  492. Breakpoints Watchpoints and Exceptions: Breakpoints.).
  493.  
  494.    With a conditional breakpoint (*note Break Conditions: Conditions.)
  495. that depends on the value of ID, you can stop your program when a
  496. specific exception is raised.  You can use multiple conditional
  497. breakpoints to stop your program when any of a number of exceptions are
  498. raised.
  499.  
  500. 
  501. File: gdb.info,  Node: Delete Breaks,  Next: Disabling,  Prev: Exception Handling,  Up: Breakpoints
  502.  
  503. Deleting Breakpoints
  504. --------------------
  505.  
  506.    It is often necessary to eliminate a breakpoint or watchpoint once
  507. it has done its job and you no longer want your program to stop there.
  508.  This is called "deleting" the breakpoint.  A breakpoint that has been
  509. deleted no longer exists; it is forgotten.
  510.  
  511.    With the `clear' command you can delete breakpoints according to
  512. where they are in your program.  With the `delete' command you can
  513. delete individual breakpoints or watchpoints by specifying their
  514. breakpoint numbers.
  515.  
  516.    It is not necessary to delete a breakpoint to proceed past it.  GDB
  517. automatically ignores breakpoints on the first instruction to be
  518. executed when you continue execution without changing the execution
  519. address.
  520.  
  521. `clear'
  522.      Delete any breakpoints at the next instruction to be executed in
  523.      the selected stack frame (*note Selecting a Frame: Selection.). 
  524.      When the innermost frame is selected, this is a good way to
  525.      delete a breakpoint where your program just stopped.
  526.  
  527. `clear FUNCTION'
  528. `clear FILENAME:FUNCTION'
  529.      Delete any breakpoints set at entry to the function FUNCTION.
  530.  
  531. `clear LINENUM'
  532. `clear FILENAME:LINENUM'
  533.      Delete any breakpoints set at or within the code of the specified
  534.      line.
  535.  
  536. `delete [breakpoints] [BNUMS...]'
  537.      Delete the breakpoints or watchpoints of the numbers specified as
  538.      arguments.  If no argument is specified, delete all breakpoints
  539.      (GDB asks confirmation, unless you have `set confirm off').  You
  540.      can abbreviate this command as `d'.
  541.  
  542. 
  543. File: gdb.info,  Node: Disabling,  Next: Conditions,  Prev: Delete Breaks,  Up: Breakpoints
  544.  
  545. Disabling Breakpoints
  546. ---------------------
  547.  
  548.    Rather than deleting a breakpoint or watchpoint, you might prefer to
  549. "disable" it.  This makes the breakpoint inoperative as if it had been
  550. deleted, but remembers the information on the breakpoint so that you
  551. can "enable" it again later.
  552.  
  553.    You disable and enable breakpoints and watchpoints with the
  554. `enable' and `disable' commands, optionally specifying one or more
  555. breakpoint numbers as arguments.  Use `info break' or `info watch' to
  556. print a list of breakpoints or watchpoints if you do not know which
  557. numbers to use.
  558.  
  559.    A breakpoint or watchpoint can have any of four different states of
  560. enablement:
  561.  
  562.    * Enabled.  The breakpoint will stop your program.  A breakpoint set
  563.      with the `break' command starts out in this state.
  564.  
  565.    * Disabled.  The breakpoint has no effect on your program.
  566.  
  567.    * Enabled once.  The breakpoint will stop your program, but when it
  568.      does so it will become disabled.  A breakpoint set with the
  569.      `tbreak' command starts out in this state.
  570.  
  571.    * Enabled for deletion.  The breakpoint will stop your program, but
  572.      immediately after it does so it will be deleted permanently.
  573.  
  574.    You can use the following commands to enable or disable breakpoints
  575. and watchpoints:
  576.  
  577. `disable [breakpoints] [BNUMS...]'
  578.      Disable the specified breakpoints--or all breakpoints, if none are
  579.      listed.  A disabled breakpoint has no effect but is not
  580.      forgotten.  All options such as ignore-counts, conditions and
  581.      commands are remembered in case the breakpoint is enabled again
  582.      later.  You may abbreviate `disable' as `dis'.
  583.  
  584. `enable [breakpoints] [BNUMS...]'
  585.      Enable the specified breakpoints (or all defined breakpoints). 
  586.      They become effective once again in stopping your program.
  587.  
  588. `enable [breakpoints] once BNUMS...'
  589.      Enable the specified breakpoints temporarily.  Each will be
  590.      disabled again the next time it stops your program.
  591.  
  592. `enable [breakpoints] delete BNUMS...'
  593.      Enable the specified breakpoints to work once and then die.  Each
  594.      of the breakpoints will be deleted the next time it stops your
  595.      program.
  596.  
  597.    Save for a breakpoint set with `tbreak' (*note Setting Breakpoints:
  598. Set Breaks.), breakpoints that you set are initially enabled;
  599. subsequently, they become disabled or enabled only when you use one of
  600. the commands above.  (The command `until' can set and delete a
  601. breakpoint of its own, but it will not change the state of your other
  602. breakpoints; see *Note Continuing and Stepping: Continuing and
  603. Stepping.)
  604.  
  605. 
  606. File: gdb.info,  Node: Conditions,  Next: Break Commands,  Prev: Disabling,  Up: Breakpoints
  607.  
  608. Break Conditions
  609. ----------------
  610.  
  611.    The simplest sort of breakpoint breaks every time your program
  612. reaches a specified place.  You can also specify a "condition" for a
  613. breakpoint.  A condition is just a Boolean expression in your
  614. programming language (*note Expressions: Expressions.).  A breakpoint
  615. with a condition evaluates the expression each time your program
  616. reaches it, and your program stops only if the condition is *true*.
  617.  
  618.    This is the converse of using assertions for program validation; in
  619. that situation, you want to stop when the assertion is violated--that
  620. is, when the condition is false.  In C, if you want to test an
  621. assertion expressed by the condition ASSERT, you should set the
  622. condition `! ASSERT' on the appropriate breakpoint.
  623.  
  624.    Conditions are also accepted for watchpoints; you may not need them,
  625. since a watchpoint is inspecting the value of an expression anyhow--but
  626. it might be simpler, say, to just set a watchpoint on a variable name,
  627. and specify a condition that tests whether the new value is an
  628. interesting one.
  629.  
  630.    Break conditions can have side effects, and may even call functions
  631. in your program.  This can be useful, for example, to activate
  632. functions that log program progress, or to use your own print
  633. functions to format special data structures. The effects are
  634. completely predictable unless there is another enabled breakpoint at
  635. the same address.  (In that case, GDB might see the other breakpoint
  636. first and stop your program without checking the condition of this
  637. one.)  Note that breakpoint commands are usually more convenient and
  638. flexible for the purpose of performing side effects when a breakpoint
  639. is reached (*note Breakpoint Command Lists: Break Commands.).
  640.  
  641.    Break conditions can be specified when a breakpoint is set, by using
  642. `if' in the arguments to the `break' command.  *Note Setting
  643. Breakpoints: Set Breaks.  They can also be changed at any time with
  644. the `condition' command.  The `watch' command does not recognize the
  645. `if' keyword; `condition' is the only way to impose a further
  646. condition on a watchpoint.
  647.  
  648. `condition BNUM EXPRESSION'
  649.      Specify EXPRESSION as the break condition for breakpoint or
  650.      watchpoint number BNUM.  From now on, this breakpoint will stop
  651.      your program only if the value of EXPRESSION is true (nonzero, in
  652.      C).  When you use `condition', GDB checks EXPRESSION immediately
  653.      for syntactic correctness, and to determine whether symbols in it
  654.      have referents in the context of your breakpoint.  GDB does not
  655.      actually evaluate EXPRESSION at the time the `condition' command
  656.      is given, however.  *Note Expressions: Expressions.
  657.  
  658. `condition BNUM'
  659.      Remove the condition from breakpoint number BNUM.  It becomes an
  660.      ordinary unconditional breakpoint.
  661.  
  662.    A special case of a breakpoint condition is to stop only when the
  663. breakpoint has been reached a certain number of times.  This is so
  664. useful that there is a special way to do it, using the "ignore count"
  665. of the breakpoint.  Every breakpoint has an ignore count, which is an
  666. integer.  Most of the time, the ignore count is zero, and therefore
  667. has no effect.  But if your program reaches a breakpoint whose ignore
  668. count is positive, then instead of stopping, it just decrements the
  669. ignore count by one and continues.  As a result, if the ignore count
  670. value is N, the breakpoint will not stop the next N times it is
  671. reached.
  672.  
  673. `ignore BNUM COUNT'
  674.      Set the ignore count of breakpoint number BNUM to COUNT.  The
  675.      next COUNT times the breakpoint is reached, your program's
  676.      execution will not stop; other than to decrement the ignore
  677.      count, GDB takes no action.
  678.  
  679.      To make the breakpoint stop the next time it is reached, specify
  680.      a count of zero.
  681.  
  682. `continue COUNT'
  683. `c COUNT'
  684. `fg COUNT'
  685.      Continue execution of your program, setting the ignore count of
  686.      the breakpoint where your program stopped to COUNT minus one. 
  687.      Thus, your program will not stop at this breakpoint until the
  688.      COUNT'th time it is reached.
  689.  
  690.      An argument to this command is meaningful only when your program
  691.      stopped due to a breakpoint.  At other times, the argument to
  692.      `continue' is ignored.
  693.  
  694.      The synonym `fg' is provided purely for convenience, and has
  695.      exactly the same behavior as other forms of the command.
  696.  
  697.    If a breakpoint has a positive ignore count and a condition, the
  698. condition is not checked.  Once the ignore count reaches zero, the
  699. condition will be checked.
  700.  
  701.    You could achieve the effect of the ignore count with a condition
  702. such as `$foo-- <= 0' using a debugger convenience variable that is
  703. decremented each time.  *Note Convenience Variables: Convenience Vars.
  704.  
  705. 
  706. File: gdb.info,  Node: Break Commands,  Next: Breakpoint Menus,  Prev: Conditions,  Up: Breakpoints
  707.  
  708. Breakpoint Command Lists
  709. ------------------------
  710.  
  711.    You can give any breakpoint (or watchpoint) a series of commands to
  712. execute when your program stops due to that breakpoint.  For example,
  713. you might want to print the values of certain expressions, or enable
  714. other breakpoints.
  715.  
  716. `commands [BNUM]'
  717. `... COMMAND-LIST ...'
  718. `end'
  719.      Specify a list of commands for breakpoint number BNUM.  The
  720.      commands themselves appear on the following lines.  Type a line
  721.      containing just `end' to terminate the commands.
  722.  
  723.      To remove all commands from a breakpoint, type `commands' and
  724.      follow it immediately with `end'; that is, give no commands.
  725.  
  726.      With no BNUM argument, `commands' refers to the last breakpoint
  727.      or watchpoint set (not to the breakpoint most recently
  728.      encountered).
  729.  
  730.    Pressing RET as a means of repeating the last GDB command is
  731. disabled within a COMMAND-LIST.
  732.  
  733.    You can use breakpoint commands to start your program up again. 
  734. Simply use the `continue' command, or `step', or any other command
  735. that resumes execution.  Subsequent commands in the command list are
  736. ignored.
  737.  
  738.    If the first command specified is `silent', the usual message about
  739. stopping at a breakpoint is not printed.  This may be desirable for
  740. breakpoints that are to print a specific message and then continue. 
  741. If the remaining commands too print nothing, you will see no sign that
  742. the breakpoint was reached at all.  `silent' is meaningful only at the
  743. beginning of a breakpoint command list.
  744.  
  745.    The commands `echo' and `output' that allow you to print precisely
  746. controlled output are often useful in silent breakpoints.  *Note
  747. Commands for Controlled Output: Output.
  748.  
  749.    For example, here is how you could use breakpoint commands to print
  750. the value of `x' at entry to `foo' whenever `x' is positive.
  751.  
  752.      break foo if x>0
  753.      commands
  754.      silent
  755.      echo x is\040
  756.      output x
  757.      echo \n
  758.      cont
  759.      end
  760.  
  761.    One application for breakpoint commands is to compensate for one
  762. bug so you can test for another.  Put a breakpoint just after the
  763. erroneous line of code, give it a condition to detect the case in
  764. which something erroneous has been done, and give it commands to
  765. assign correct values to any variables that need them.  End with the
  766. `continue' command so that your program does not stop, and start with
  767. the `silent' command so that no output is produced.  Here is an
  768. example:
  769.  
  770.      break 403
  771.      commands
  772.      silent
  773.      set x = y + 4
  774.      cont
  775.      end
  776.  
  777.    One deficiency in the operation of automatically continuing
  778. breakpoints under Unix appears when your program uses raw mode for the
  779. terminal.  GDB switches back to its own terminal modes (not raw)
  780. before executing commands, and then must switch back to raw mode when
  781. your program is continued.  This causes any pending terminal input to
  782. be lost.
  783.  
  784.    Under Unix, you can get around this problem by writing actions into
  785. the breakpoint condition rather than in commands.  For example
  786.  
  787.      condition 5  (x = y + 4), 0
  788.  
  789. specifies a condition expression (*note Expressions: Expressions.)
  790. that will change `x' as needed, then always have the value zero so your
  791. program will not stop.  No input is lost here, because GDB evaluates
  792. break conditions without changing the terminal modes.  When you want
  793. to have nontrivial conditions for performing the side effects, the
  794. operators `&&', `||' and `?...:' may be useful.
  795.  
  796. 
  797. File: gdb.info,  Node: Breakpoint Menus,  Next: Error in Breakpoints,  Prev: Break Commands,  Up: Breakpoints
  798.  
  799. Breakpoint Menus
  800. ----------------
  801.  
  802.    Some programming languages (notably C++) permit a single function
  803. name to be defined several times, for application in different
  804. contexts.  This is called "overloading".  When a function name is
  805. overloaded, `break FUNCTION' is not enough to tell GDB where you want
  806. a breakpoint.  GDB offers you a menu of numbered choices for different
  807. possible breakpoints, and waits for your selection with the prompt
  808. `>'.  The first two options are always `[0] cancel' and `[1] all'. 
  809. Typing `1' sets a breakpoint at each definition of FUNCTION, and
  810. typing `0' aborts the `break' command without setting any new
  811. breakpoints.
  812.  
  813.    For example, the following session excerpt shows an attempt to set a
  814. breakpoint at the overloaded symbol `String::after'.  We choose three
  815. particular definitions of that function name:
  816.  
  817.      (gdb) b String::after
  818.      [0] cancel
  819.      [1] all
  820.      [2] file:String.cc; line number:867
  821.      [3] file:String.cc; line number:860
  822.      [4] file:String.cc; line number:875
  823.      [5] file:String.cc; line number:853
  824.      [6] file:String.cc; line number:846
  825.      [7] file:String.cc; line number:735
  826.      > 2 4 6
  827.      Breakpoint 1 at 0xb26c: file String.cc, line 867.
  828.      Breakpoint 2 at 0xb344: file String.cc, line 875.
  829.      Breakpoint 3 at 0xafcc: file String.cc, line 846.
  830.      Multiple breakpoints were set.
  831.      Use the "delete" command to delete unwanted breakpoints.
  832.      (gdb)
  833.  
  834. 
  835. File: gdb.info,  Node: Error in Breakpoints,  Prev: Breakpoint Menus,  Up: Breakpoints
  836.  
  837. "Cannot Insert Breakpoints"
  838. ---------------------------
  839.  
  840.    Under some operating systems, breakpoints cannot be used in a
  841. program if any other process is running that program.  In this
  842. situation, attempting to run or continue a program with a breakpoint
  843. causes GDB to stop the other process.
  844.  
  845.    When this happens, you have three ways to proceed:
  846.  
  847.   1. Remove or disable the breakpoints, then continue.
  848.  
  849.   2. Suspend GDB, and copy the file containing your program to a new
  850.      name.  Resume GDB and use the `exec-file' command to specify that
  851.      GDB should run your program under that name.  Then start your
  852.      program again.
  853.  
  854.   3. Relink your program so that the text segment is nonsharable,
  855.      using the linker option `-N'.  The operating system limitation
  856.      may not apply to nonsharable executables.
  857.  
  858. 
  859. File: gdb.info,  Node: Continuing and Stepping,  Next: Signals,  Prev: Breakpoints,  Up: Stopping
  860.  
  861. Continuing and Stepping
  862. =======================
  863.  
  864.    "Continuing" means resuming program execution until your program
  865. completes normally.  In contrast, "stepping" means executing just one
  866. more "step" of your program, where "step" may mean either one line of
  867. source code, or one machine instruction (depending on what particular
  868. command you use).  Either when continuing or when stepping, your
  869. program may stop even sooner, due to a breakpoint or to a signal.  (If
  870. due to a signal, you may want to use `handle', or use `signal 0' to
  871. resume execution.  *Note Signals: Signals.)
  872.  
  873. `continue [IGNORE-COUNT]'
  874.      Resume program execution, at the address where your program last
  875.      stopped; any breakpoints set at that address are bypassed.  The
  876.      optional argument IGNORE-COUNT allows you to specify a further
  877.      number of times to ignore a breakpoint at this location; its
  878.      effect is like that of `ignore' (*note Break Conditions:
  879.      Conditions.).
  880.  
  881.      To resume execution at a different place, you can use `return'
  882.      (*note Returning from a Function: Returning.) to go back to the
  883.      calling function; or `jump' (*note Continuing at a Different
  884.      Address: Jumping.) to go to an arbitrary location in your program.
  885.  
  886.    A typical technique for using stepping is to set a breakpoint
  887. (*note Breakpoints Watchpoints and Exceptions: Breakpoints.) at the
  888. beginning of the function or the section of your program where a
  889. problem is believed to lie, run your program until it stops at that
  890. breakpoint, and then step through the suspect area, examining the
  891. variables that are interesting, until you see the problem happen.
  892.  
  893. `step'
  894.      Continue running your program until control reaches a different
  895.      source line, then stop it and return control to GDB.  This
  896.      command is abbreviated `s'.
  897.  
  898.           *Warning:* If you use the `step' command while control is
  899.           within a function that was compiled without debugging
  900.           information, execution will proceed until control reaches
  901.           another function.
  902.  
  903. `step COUNT'
  904.      Continue running as in `step', but do so COUNT times.  If a
  905.      breakpoint is reached or a signal not related to stepping occurs
  906.      before COUNT steps, stepping stops right away.
  907.  
  908. `next [COUNT]'
  909.      Continue to the next source line in the current (innermost) stack
  910.      frame.  Similar to `step', but any function calls appearing
  911.      within the line of code are executed without stopping.  Execution
  912.      stops when control reaches a different line of code at the stack
  913.      level which was executing when the `next' command was given. 
  914.      This command is abbreviated `n'.
  915.  
  916.      An argument COUNT is a repeat count, as for `step'.
  917.  
  918.      `next' within a function that lacks debugging information acts
  919.      like `step', but any function calls appearing within the code of
  920.      the function are executed without stopping.
  921.  
  922. `finish'
  923.      Continue running until just after function in the selected stack
  924.      frame returns.  Print the returned value (if any).
  925.  
  926.      Contrast this with the `return' command (*note Returning from a
  927.      Function: Returning.).
  928.  
  929. `until'
  930. `u'
  931.      Continue running until a source line past the current line, in the
  932.      current stack frame, is reached.  This command is used to avoid
  933.      single stepping through a loop more than once.  It is like the
  934.      `next' command, except that when `until' encounters a jump, it
  935.      automatically continues execution until the program counter is
  936.      greater than the address of the jump.
  937.  
  938.      This means that when you reach the end of a loop after single
  939.      stepping though it, `until' will cause your program to continue
  940.      execution until the loop is exited.  In contrast, a `next'
  941.      command at the end of a loop will simply step back to the
  942.      beginning of the loop, which would force you to step through the
  943.      next iteration.
  944.  
  945.      `until' always stops your program if it attempts to exit the
  946.      current stack frame.
  947.  
  948.      `until' may produce somewhat counterintuitive results if the order
  949.      of machine code does not match the order of the source lines.  For
  950.      example, in the following excerpt from a debugging session, the
  951.      `f' (`frame') command shows that execution is stopped at line
  952.      `206'; yet when we use `until', we get to line `195':
  953.  
  954.           (gdb) f
  955.           #0  main (argc=4, argv=0xf7fffae8) at m4.c:206
  956.           206                 expand_input();
  957.           (gdb) until
  958.           195             for ( ; argc > 0; NEXTARG) {
  959.  
  960.      This happened because, for execution efficiency, the compiler had
  961.      generated code for the loop closure test at the end, rather than
  962.      the start, of the loop--even though the test in a C `for'-loop is
  963.      written before the body of the loop.  The `until' command appeared
  964.      to step back to the beginning of the loop when it advanced to this
  965.      expression; however, it has not really gone to an earlier
  966.      statement--not in terms of the actual machine code.
  967.  
  968.      `until' with no argument works by means of single instruction
  969.      stepping, and hence is slower than `until' with an argument.
  970.  
  971. `until LOCATION'
  972. `u LOCATION'
  973.      Continue running your program until either the specified location
  974.      is reached, or the current stack frame returns.  LOCATION is any
  975.      of the forms of argument acceptable to `break' (*note Setting
  976.      Breakpoints: Set Breaks.).  This form of the command uses
  977.      breakpoints, and hence is quicker than `until' without an
  978.      argument.
  979.  
  980. `stepi'
  981. `si'
  982.      Execute one machine instruction, then stop and return to the
  983.      debugger.
  984.  
  985.      It is often useful to do `display/i $pc' when stepping by machine
  986.      instructions.  This will cause the next instruction to be
  987.      executed to be displayed automatically at each stop.  *Note
  988.      Automatic Display: Auto Display.
  989.  
  990.      An argument is a repeat count, as in `step'.
  991.  
  992. `nexti'
  993. `ni'
  994.      Execute one machine instruction, but if it is a function call,
  995.      proceed until the function returns.
  996.  
  997.      An argument is a repeat count, as in `next'.
  998.  
  999. 
  1000. File: gdb.info,  Node: Signals,  Prev: Continuing and Stepping,  Up: Stopping
  1001.  
  1002. Signals
  1003. =======
  1004.  
  1005.    A signal is an asynchronous event that can happen in a program.  The
  1006. operating system defines the possible kinds of signals, and gives each
  1007. kind a name and a number.  For example, in Unix `SIGINT' is the signal
  1008. a program gets when you type an interrupt (often `C-c'); `SIGSEGV' is
  1009. the signal a program gets from referencing a place in memory far away
  1010. from all the areas in use; `SIGALRM' occurs when the alarm clock timer
  1011. goes off (which happens only if your program has requested an alarm).
  1012.  
  1013.    Some signals, including `SIGALRM', are a normal part of the
  1014. functioning of your program.  Others, such as `SIGSEGV', indicate
  1015. errors; these signals are "fatal" (kill your program immediately) if
  1016. the program has not specified in advance some other way to handle the
  1017. signal.  `SIGINT' does not indicate an error in your program, but it
  1018. is normally fatal so it can carry out the purpose of the interrupt: to
  1019. kill the program.
  1020.  
  1021.    GDB has the ability to detect any occurrence of a signal in your
  1022. program.  You can tell GDB in advance what to do for each kind of
  1023. signal.
  1024.  
  1025.    Normally, GDB is set up to ignore non-erroneous signals like
  1026. `SIGALRM' (so as not to interfere with their role in the functioning
  1027. of your program) but to stop your program immediately whenever an
  1028. error signal happens.  You can change these settings with the `handle'
  1029. command.
  1030.  
  1031. `info signals'
  1032.      Print a table of all the kinds of signals and how GDB has been
  1033.      told to handle each one.  You can use this to see the signal
  1034.      numbers of all the defined types of signals.
  1035.  
  1036. `handle SIGNAL KEYWORDS...'
  1037.      Change the way GDB handles signal SIGNAL.  SIGNAL can be the
  1038.      number of a signal or its name (with or without the `SIG' at the
  1039.      beginning).  The KEYWORDS say what change to make.
  1040.  
  1041.    The keywords allowed by the `handle' command can be abbreviated. 
  1042. Their full names are:
  1043.  
  1044. `nostop'
  1045.      GDB should not stop your program when this signal happens.  It may
  1046.      still print a message telling you that the signal has come in.
  1047.  
  1048. `stop'
  1049.      GDB should stop your program when this signal happens.  This
  1050.      implies the `print' keyword as well.
  1051.  
  1052. `print'
  1053.      GDB should print a message when this signal happens.
  1054.  
  1055. `noprint'
  1056.      GDB should not mention the occurrence of the signal at all.  This
  1057.      implies the `nostop' keyword as well.
  1058.  
  1059. `pass'
  1060.      GDB should allow your program to see this signal; your program
  1061.      will be able to handle the signal, or may be terminated if the
  1062.      signal is fatal and not handled.
  1063.  
  1064. `nopass'
  1065.      GDB should not allow your program to see this signal.
  1066.  
  1067.    When a signal has been set to stop your program, your program
  1068. cannot see the signal until you continue.  It will see the signal
  1069. then, if `pass' is in effect for the signal in question *at that
  1070. time*.  In other words, after GDB reports a signal, you can use the
  1071. `handle' command with `pass' or `nopass' to control whether that
  1072. signal will be seen by your program when you later continue it.
  1073.  
  1074.    You can also use the `signal' command to prevent your program from
  1075. seeing a signal, or cause it to see a signal it normally would not see,
  1076. or to give it any signal at any time.  For example, if your program
  1077. stopped due to some sort of memory reference error, you might store
  1078. correct values into the erroneous variables and continue, hoping to
  1079. see more execution; but your program would probably terminate
  1080. immediately as a result of the fatal signal once it saw the signal. 
  1081. To prevent this, you can continue with `signal 0'.  *Note Giving your
  1082. Program a Signal: Signaling.
  1083.  
  1084. 
  1085. File: gdb.info,  Node: Stack,  Next: Source,  Prev: Stopping,  Up: Top
  1086.  
  1087. Examining the Stack
  1088. *******************
  1089.  
  1090.    When your program has stopped, the first thing you need to know is
  1091. where it stopped and how it got there.
  1092.  
  1093.    Each time your program performs a function call, the information
  1094. about where in your program the call was made from is saved in a block
  1095. of data called a "stack frame".  The frame also contains the arguments
  1096. of the call and the local variables of the function that was called. 
  1097. All the stack frames are allocated in a region of memory called the
  1098. "call stack".
  1099.  
  1100.    When your program stops, the GDB commands for examining the stack
  1101. allow you to see all of this information.
  1102.  
  1103.    One of the stack frames is "selected" by GDB and many GDB commands
  1104. refer implicitly to the selected frame.  In particular, whenever you
  1105. ask GDB for the value of a variable in your program, the value is
  1106. found in the selected frame.  There are special GDB commands to select
  1107. whichever frame you are interested in.
  1108.  
  1109.    When your program stops, GDB automatically selects the currently
  1110. executing frame and describes it briefly as the `frame' command does
  1111. (*note Information About a Frame: Frame Info.).
  1112.  
  1113. * Menu:
  1114.  
  1115. * Frames::                      Stack Frames
  1116. * Backtrace::                   Backtraces
  1117. * Selection::                   Selecting a Frame
  1118. * Frame Info::                  Information on a Frame
  1119.  
  1120. 
  1121. File: gdb.info,  Node: Frames,  Next: Backtrace,  Prev: Stack,  Up: Stack
  1122.  
  1123. Stack Frames
  1124. ============
  1125.  
  1126.    The call stack is divided up into contiguous pieces called "stack
  1127. frames", or "frames" for short; each frame is the data associated with
  1128. one call to one function.  The frame contains the arguments given to
  1129. the function, the function's local variables, and the address at which
  1130. the function is executing.
  1131.  
  1132.    When your program is started, the stack has only one frame, that of
  1133. the function `main'.  This is called the "initial" frame or the
  1134. "outermost" frame.  Each time a function is called, a new frame is
  1135. made.  Each time a function returns, the frame for that function
  1136. invocation is eliminated.  If a function is recursive, there can be
  1137. many frames for the same function.  The frame for the function in
  1138. which execution is actually occurring is called the "innermost" frame.
  1139.  This is the most recently created of all the stack frames that still
  1140. exist.
  1141.  
  1142.    Inside your program, stack frames are identified by their
  1143. addresses.  A stack frame consists of many bytes, each of which has
  1144. its own address; each kind of computer has a convention for choosing
  1145. one of those bytes whose address serves as the address of the frame. 
  1146. Usually this address is kept in a register called the "frame pointer
  1147. register" while execution is going on in that frame.
  1148.  
  1149.    GDB assigns numbers to all existing stack frames, starting with
  1150. zero for the innermost frame, one for the frame that called it, and so
  1151. on upward.  These numbers do not really exist in your program; they
  1152. are assigned by GDB to give you a way of designating stack frames in
  1153. GDB commands.
  1154.  
  1155.    Some compilers allow functions to be compiled so that they operate
  1156. without stack frames.  (For example, the `gcc' option
  1157. `-fomit-frame-pointer' will generate functions without a frame.) This
  1158. is occasionally done with heavily used library functions to save the
  1159. frame setup time.  GDB has limited facilities for dealing with these
  1160. function invocations.  If the innermost function invocation has no
  1161. stack frame, GDB will nevertheless regard it as though it had a
  1162. separate frame, which is numbered zero as usual, allowing correct
  1163. tracing of the function call chain.  However, GDB has no provision for
  1164. frameless functions elsewhere in the stack.
  1165.  
  1166. 
  1167. File: gdb.info,  Node: Backtrace,  Next: Selection,  Prev: Frames,  Up: Stack
  1168.  
  1169. Backtraces
  1170. ==========
  1171.  
  1172.    A backtrace is a summary of how your program got where it is.  It
  1173. shows one line per frame, for many frames, starting with the currently
  1174. executing frame (frame zero), followed by its caller (frame one), and
  1175. on up the stack.
  1176.  
  1177. `backtrace'
  1178. `bt'
  1179.      Print a backtrace of the entire stack: one line per frame for all
  1180.      frames in the stack.
  1181.  
  1182.      You can stop the backtrace at any time by typing the system
  1183.      interrupt character, normally `C-c'.
  1184.  
  1185. `backtrace N'
  1186. `bt N'
  1187.      Similar, but print only the innermost N frames.
  1188.  
  1189. `backtrace -N'
  1190. `bt -N'
  1191.      Similar, but print only the outermost N frames.
  1192.  
  1193.    The names `where' and `info stack' (abbreviated `info s') are
  1194. additional aliases for `backtrace'.
  1195.  
  1196.    Each line in the backtrace shows the frame number and the function
  1197. name.  The program counter value is also shown--unless you use `set
  1198. print address off'.  The backtrace also shows the source file name and
  1199. line number, as well as the arguments to the function.  The program
  1200. counter value is omitted if it is at the beginning of the code for that
  1201. line number.
  1202.  
  1203.    Here is an example of a backtrace.  It was made with the command
  1204. `bt 3', so it shows the innermost three frames.
  1205.  
  1206.      #0  m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8)
  1207.          at builtin.c:993
  1208.      #1  0x6e38 in expand_macro (sym=0x2b600) at macro.c:242
  1209.      #2  0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
  1210.          at macro.c:71
  1211.      (More stack frames follow...)
  1212.  
  1213. The display for frame zero does not begin with a program counter
  1214. value, indicating that your program has stopped at the beginning of the
  1215. code for line `993' of `builtin.c'.
  1216.  
  1217.